<template>
	<view>
		<uni-nav-bar @clickLeft='clickLeft()' left-icon="left" statusBar :title="title" :border='false' color="#000" fixed
			backgroundColor='#ffffff00'>
		</uni-nav-bar>
		<image class="BGImage" :src="getImageUrl('/static/common/BG.png')" mode=""></image>
		<view class="" style="position: relative;z-index: 2;">

			<u-tabs v-if="type==0||type==1" bold :current="tabsIndex1" @click="tabClick1"
				style="background-color: #FFFFFF00;" :list="tabsList1" lineWidth="32" lineColor="#F54C0D" :activeStyle="{
											color: '#1A1A16',
											
											transform: 'scale(1)',
											fontWeight:'bold'
											
										}" :inactiveStyle="{
											color: '#535353',
											transform: 'scale(1)'
										}" itemStyle="  height: 44px;width:50%">
			</u-tabs>

			<u-tabs v-if="type==0||type==1" bold :current="tabsIndex" @click="tabClick" style="background-color: #FFFFFF00;" :list="tabsList"
				lineWidth="32" lineColor="#F54C0D" :activeStyle="{
											color: '#1A1A16',
											
											transform: 'scale(1)',
											fontWeight:'bold'
											
										}" :inactiveStyle="{
											color: '#535353',
											transform: 'scale(1)'
										}" itemStyle="  height: 44px;padding:0 20rpx">
											</u-tabs>
										<u-tabs v-if="type==2||type==3" bold :current="tabsIndex" @click="tabClick" style="background-color: #FFFFFF00;" :list="tabsList"
											lineWidth="32" lineColor="#F54C0D" :activeStyle="{
																		color: '#1A1A16',
																		
																		transform: 'scale(1)',
																		fontWeight:'bold'
																		
																	}" :inactiveStyle="{
																		color: '#535353',
																		transform: 'scale(1)'
																	}" itemStyle="  height: 44px;width:20%">
			</u-tabs>
			<u-empty>
			</u-empty>


		</view>

	</view>
</template>

<script>
	import {
		mapActions,
		mapState
	} from "vuex";
	import {
		profile,
	} from '@/api/index.js'
	export default {
		components: {},
		computed: {

		},
		data() {
			return {
				title:'',
				type: 0,
				tabsIndex: 0,
				tabsList: [{
						name: '待审核',
						status: ""
					},
					{
						name: '待送货',
						status: "0"
					},

					{
						name: '已完成',
						status: "1"
					},
					{
						name: '订单违约',
						status: "2"
					},
					{
						name: '已拒绝',
						status: "3"
					},
					{
						name: '已取消',
						status: "3"
					},
				],
				tabsIndex1: 0,
				tabsList1: [{
						name: '卖金定价',
						status: ""
					},
					{
						name: '卖金结算',
						status: "0"
					},


				],

			}
		},
		computed: {
			...mapState([
				'baseColor'
			]),
		},
		onPageScroll(e) {
			if (e.scrollTop > 20) {
				this.backgroundColor = "#AED0FC"
			} else {
				this.backgroundColor = "#ffffff00"
			}
		},
		onShow() {

			// this.userinfo=uni.getStorageSync('userinfo')
			// 			this.profile()
		},
		onLoad(e) {

			if (e.type) {
				this.type = e.type
			}
			var title = '卖金订单'

			if (this.type == 1) {
				title = '买金订单'
				this.tabsList1 = [{
							name: '买金定价',
							status: ""
						},
						{
							name: '买金结算',
							status: "0"
						},


					],
					this.tabsList = [{
							name: '全部',
							status: ""
						},
						{
							name: '待审核',
							status: "0"
						},

						{
							name: '待付款',
							status: "1"
						},
						{
							name: '待付款/上传付款凭证',
							status: "2"
						},
						{
							name: '取料中/送货中',
							status: "3"
						},
						{
							name: '订单违约',
							status: "3"
						},
						{
							name: '已拒绝',
							status: ""
						},
						{
							name: '已取消',
							status: "0"
						},

						{
							name: '已完成',
							status: "1"
						},
					]
			}
			if (this.type == 2) {
				title = '延结订单'
				this.tabsList = [{
						name: '全部',
						status: ""
					},
					{
						name: '待确认',
						status: "0"
					},
				
					{
						name: '延结中',
						status: "1"
					},
					{
						name: '代收尾款',
						status: "1"
					},
					{
						name: '已完成',
						status: "1"
					},
				]
			}
			if (this.type == 3) {
				title = '提金订单'
				
				this.tabsList = [{
						name: '全部',
						status: ""
					},
					{
						name: '待审核',
						status: "0"
					},
				
					{
						name: '待交料',
						status: "1"
					},
					{
						name: '待付款',
						status: "1"
					},
					{
						name: '已完成',
						status: "1"
					},
				]
			}
			if (this.type == 4) {
				title = '物料订单'
			}
			this.title=title
		},
		//下拉刷新
		onPullDownRefresh() {


		},
		//加载更多
		onReachBottom() {

		},
		onPageScroll(e) {
			// if (e.scrollTop > 20) {
			// 	this.backgroundColor = "#FBF9FF"
			// } else {
			// 	this.backgroundColor = "#ffffff00"
			// }
		},
		methods: {
			clickLeft() {
				uni.navigateBack()
			},
			itemClick(item) {
				if (item.url) {
					this.toUrl(item.url)
				} else {
					this.showToast('请先实名')
				}
			},
			roleClick() {
				if (this.userinfo.group_id == 3 || this.userinfo.group_id == 0) {
					return
				}
				uni.navigateTo({
					url: '/pages/index/setRole'
				})
			},
			profile() {

				var data = {

				}
				profile(data).then(res => {

					uni.setStorageSync('userinfo', res.data)
					this.userinfo = uni.getStorageSync('userinfo')


				})
			},
			buttonClick() {
				uni.removeStorageSync('token')
				uni.navigateTo({
					url: '/pages/login/login'
				})
			},
			loadData() {

				var data = {
					id: this.id
				}
				forum_list(data).then(res => {
					this.list = res.data.data
				})
			},


		}
	}
</script>

<style lang="scss">

</style>